package rents.internal.account;

import common.money.MonetaryAmount;
import common.money.Percentage;
import common.repository.Entity;


public class Beneficiary extends Entity {
	
	private String name;

	private Percentage allocationPercentage;

	private MonetaryAmount savings = MonetaryAmount.valueOf("0.00");

	@SuppressWarnings("unused")
	private Beneficiary() {
	}

	
	public Beneficiary(String name, Percentage allocationPercentage) {
		this.name = name;
		this.allocationPercentage = allocationPercentage;
	}

	
	Beneficiary(String name, Percentage allocationPercentage, MonetaryAmount savings) {
		this.name = name;
		this.allocationPercentage = allocationPercentage;
		this.savings = savings;
	}

	
	public String getName() {
		return name;
	}

	
	public Percentage getAllocationPercentage() {
		return allocationPercentage;
	}

	
	public MonetaryAmount getSavings() {
		return savings;
	}

	
	public void credit(MonetaryAmount amount) {
		savings = savings.add(amount);
	}

	public String toString() {
		return "name = '" + name + "', allocationPercentage = " + allocationPercentage + ", savings = " + savings + ")";
	}
	
	

}
